<template>
  <div>
    <div>
      <el-row class="nav">
        <span class="font-weight">{{ $store.state.orderTypeName}}</span>
        <button @click="exportOrder"
                type="button"
                v-if="btnStates.EWS_order_export_010"
                class="el-button el-button--primary el-button--medium h30Btn  fr export">
          导出
        </button>
        <button @click=" createForm('新建')"
                type="button"
                v-if="btnStates.EWS_create_order_008"
                class="el-button el-button--primary el-button--medium h30Btn  fr">
          新建
        </button>
        <button @click="mergeOrder"
                type="button"
                v-if="btnStates.EWS_merge_order_025"
                class="el-button el-button--primary el-button--medium h30Btn fr">
          合并
        </button>
      </el-row>
      <el-divider></el-divider>
      <!-- 搜索部分 -->
      <el-row>
        <el-col :span="22">
          <avue-form v-model="form"
                     :option="option">
            <template slot-scope="scope"
                      slot="current_handler_name">
              <el-row style="display:flex;">
                <el-col :span="10">
                  <el-select v-model="current_handler_name.type"
                             clearable
                             style="width:30%"
                             @change="getSecondDataList"
                             placeholder="请选择">
                    <el-option v-for="item in handleTypeList"
                               :key="item.value"
                               :label="item.label"
                               :value="item.value">
                    </el-option>
                  </el-select>
                </el-col>
                <el-col :span="14">
                  <!-- 部门 -->
                  <el-cascader v-if="current_handler_name.type && current_handler_name.type =='dept'"
                               expand-trigger="hover"
                               :options="userValueList"
                               placeholder="请选择"
                               clearable
                               filterable
                               :props="{value:'value',label:'label',children:'children',multiple: false,checkStrictly: true }"
                               v-model="current_handler_name.value"
                               @change="handleChange">
                  </el-cascader>
                  <!-- 员工 -->
                  <el-select v-model="current_handler_name.value"
                             v-if="current_handler_name.type && current_handler_name.type =='user'"
                             clearable
                             filterable
                             :multiple="false"
                             style="width:70%"
                             placeholder="请选择">
                    <el-option v-for="item in userValueList"
                               :key="item.value"
                               :label="item.label"
                               :value="item.value">
                    </el-option>
                  </el-select>
                </el-col>
              </el-row>
            </template>
          </avue-form>
        </el-col>
        <el-col :span="2">
          <el-button size="mini"
                     class="el-button el-button--primary h30Btn  searchBtn"
                     @click="handleSearch">查询</el-button>
          <el-button size="mini"
                     class="el-button el-button--primary h30Btn  searchBtn"
                     @click="resart">重置</el-button>
          <el-button size="mini"
                     v-if="itemType == '2'"
                     class="el-button el-button--primary h30Btn  searchBtn"
                     @click="advanceFilterFun">高级筛选</el-button>
        </el-col>
      </el-row>
      <avue-crud :option="orderOption"
                 @selection-change="handleSelectionChange"
                 @filter-change="filterChange"
                 :data="tableData">
        <template slot="id"
                  slot-scope="scope">
          <el-badge value="超时"
                    class="item"
                    v-if="scope.row.isTimeOut == 'Y'">
            <el-button class="order_num"
                       type="text"
                       @click="orderDetails(scope.row)">{{ scope.row.id }}</el-button>
          </el-badge>
          <el-button class="order_num"
                     v-else
                     type="text"
                     @click="orderDetails(scope.row)">{{ scope.row.id }}</el-button>
        </template>
      </avue-crud>
      <el-row>
      </el-row>
      <el-row class="paging-foot page-foot-spacing"
              :gutter="20">
        <el-col :span="14"
                style="white-space:nowrap;display:flex">
          <span class="color-select">批量操作</span>
          <span class="select-number">（已选中{{ selectAllIdLength }}条）</span>
          <el-button @click="deleteSelect"
                     v-if="btnStates.EWS_order_delete_027"
                     type="button"
                     class="el-button el-button--primary el-button--medium h30Btn  btn30-default">删除</el-button>
          <el-button @click="closeSelect"
                     v-if="btnStates.EWS_order_close_028"
                     type="button"
                     class="el-button el-button--primary el-button--medium h30Btn  btn30-default">关闭</el-button>
        </el-col>
        <el-col :span="10">
          <div class="fr">
            <el-pagination background
                           class="el-pagination-style"
                           v-show="orderPage.total > 0"
                           @size-change="handleSizeChange"
                           @current-change="handleCurrentChange"
                           :current-page="orderPage.page"
                           :page-sizes="orderPage.pageSizes"
                           :page-size="orderPage.pageSize"
                           layout="total, sizes, prev, pager, next, jumper"
                           :total="orderPage.total"></el-pagination>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import { serOption, advanceFilterOption } from "@/common/commonOption.js";
import common from "@/common/common.js";
import { selectByCode } from "@/api/customField"
import {
  getSelect,
  selectAllWorkOrderStatusName,
  selectAllWorkOrderTypeName,
  writeWithHead,
  deleteBatch,
  closeBatch,
  getUserListByWorkOrderTypeNodeId,
  advancedFilterData
} from "@/api/workOrderController";
export default {
  data () {
    return {
      handleTypeList: [
        { value: 'dept', label: '部门' },
        { value: 'user', label: '员工' }
      ],
      userValueList: [],
      current_handler_name: {
        type: '',
        value: ''
      },
      itemType: window.CONFIG.itemType,
      orderPage: {
        pageSizes: [10, 20, 30, 40, 100],
        currentPage: 1,
        total: 0,
        pageSize: 10
      },
      advanceFilter: [],
      advanceFilterData: [],
      orderOption: {
        selection: true,
        selectClearBtn: false,
        reserveSelection: true,
        page: false,
        align: 'center',
        menuAlign: 'center',
        addBtn: false,
        border: true,
        filterBtn: false,
        menu: false,
        menuBtn: false,
        refreshBtn: false,
        columnBtn: false,
        overHidden: false,
        column: []
      },
      btnStates: window.CONFIG.btnState,
      form: {},
      forms: {
        nodeVal: "",
        nodes: [],
        userType: "",
        userTypes: [],
        userValue: [],
        userOptions: [],
        seviceType: '',
        orderType: ''
        // userOptionsNew: [],//改派的用户列表
      },
      customField: {},
      searchContent: "",
      customerList: [], // 客户类别列表
      priorityList: [], // 优先级列表
      sourceList: [], // 工单来源列表
      businessTypeList: '',//业务类型数据
      orderTypeList:[], // 工单流程
      institutionList:[], //涉及机构
      workOrderTypeName: "",
      workOrderStatusId: "", // 工单状态
      statusName: "",
      orderTypes: [],
      orderStatus: [],
      selectAllIdLength: 0,
      loading: true,
      tableData: [],
      multipleSelection: [],
      dateVal: [],
      workOrderFilterId: 2,
      field: "",
      workOrderIdList: [],
      exportWorkOrderIdList: [],
      sortTag: 1,
      workOrderTypeId: this.$store.state.workOrderTypeId,
      currentWorkOrderNodeId: 0,
      jsonData: {
        list: [
          {
            type: "input",
            name: "单行文本",
            icon: "icon-input",
            options: {
              width: "100%",
              defaultValue: "",
              required: false,
              dataType: "string",
              pattern: "",
              placeholder: "",
              remoteFunc: "func_1540908864000_94322"
            },
            key: "1540908864000_94322",
            model: "input_1540908864000_94322",
            rules: [
              {
                type: "string",
                message: "单行文本格式不正确"
              }
            ]
          }
        ],
        config: {
          labelWidth: 100,
          labelPosition: "top",
          size: "small"
        }
      }, // 数据模板
      nodeContent: {},
      flowButtonArr: [],
      buttonInfo: "",
      showData: "",
    };
  },
  activated () {
    if (!this.$route.meta.isUseCache) {
      if (this.itemType == '3') {
        this.handleSearch()
      } else {
        this.tableData = []
      }
    } else {
      this.$route.meta.isUseCache = false
    }
  },
  // beforeRouteLeave (to, from, next) {
  //   if (to.name === 'orderTable' && this.itemType !== '3') {
  //     to.meta.isUseCache = true
  //   } else {
  //     to.meta.isUseCache = false
  //   }
  //   next()
  // },
  computed: {
    option () {
      let valueArray = {
        orderStatus: this.orderStatus,
        priorityList: this.priorityList,
        sourceList: this.sourceList,
        businessTypeList: this.businessTypeList,
        orderTypeList:this.orderTypeList,
        institutionList:this.institutionList
      };
      let formInfo = this.form;
      let options = serOption(valueArray, formInfo)
      options.column.push(... this.advanceFilter)
      return options;
    },
    userId () {
      return this.$store.getters.userId;
    },
    typeIdChange () {
      return this.$store.state.orderTypeId;
    },
    workOrderTypeIdFun () {
      return this.$store.state.workOrderTypeId;
    },
  },
  watch: {
    userId (newVal, oldVal) {
      this.getSelectAllWorkOrderStatusName();
      this.handleSearch();
      this.advancedFilterData()
    },
    // typeIdChange (newVal, oldVal) {
    //   this.workOrderFilterId = newVal;
    //   this.workOrderStatusId = "";
    //   this.tableData = []
    //   this.resart()
    //   this.handleSearch();
    //   this.advancedFilterData()
    //   if (window.CONFIG.itemType !== '1') {
    //     this.getSelectFieldList('priority')
    //     this.getSelectFieldList('source')
    //     this.getSelectFieldList('business_type')
    //   }
    // },
    workOrderTypeIdFun (newVal, oldVal) {
      this.workOrderTypeId = newVal;
    },
    jsonData (newVal, oldVal) {
      this.jsonData = newVal;
    },
    $route (to, from) {
      if (from.name !== 'formDetails' && to.name === 'orderTable') {
        this.workOrderStatusId = "";
        this.tableData = []
        this.resart()
        this.handleSearch();
        this.advancedFilterData()
        if (window.CONFIG.itemType !== '1') {
          this.getSelectFieldList('priority')
          this.getSelectFieldList('source')
          this.getSelectFieldList('business_type')
        }
        if (window.CONFIG.itemType == '3') {
          this.getSelectFieldList('order_type')
        }
      }
    }
  },
  created () {
    if (window.CONFIG.itemType !== '1') {
      this.getSelectFieldList('priority')
      this.getSelectFieldList('source')
      this.getSelectFieldList('business_type')
    }
    if (window.CONFIG.itemType == '3') {
      this.getSelectFieldList('order_type') 
    }
    this.handleSearch();
    this.advancedFilterData()
  },
  mounted () {
    this.getSelectAllWorkOrderStatusName();
  },
  methods: {
    // 调取部门数据
    getSecondDataList (val) {
      this.current_handler_name.value = ''
      this.userValueList = this.selectAlllInfoFun(val)
    },
    selectAlllInfoFun (val) {
      if (val === 'user') {
        return window.CONFIG.selectAllInfo.userList
      } else if (val === 'role') {
        return window.CONFIG.selectAllInfo.roleList
      } else if (val === 'dept') {
        return window.CONFIG.selectAllInfo.deptList
      } else if (val === 'all') {
        return []
      }
    },
    advancedFilterData () {
      let params = {
        workOrderFilterMenuId: this.$store.state.orderTypeId
      }
      advancedFilterData(params).then(res => {
        this.orderOption.column = res.data.data
        this.orderOption.column.forEach(item => {
          delete item.type
          item.overHidden = true
          switch (item.prop) {
            case 'create_time':
              item['searchRange'] = true
              item['valueFormat'] = "yyyy-MM-dd HH:mm:ss"
              break;
          }
          if (item.type == 'checkbox' || item.type == 'radio' || item.type == 'select' || item.type == 'cascader') {
            if (item.prop == 'status_id' || item.prop == 'work_order_type_id') {
              item.prop = item.prop + ''
            } else {
              item.prop = item.prop + '_label'
            }
          }
        })
      })
    },
    //锦程定制的高级筛选字段
    advanceFilterFun () {
      let valueArray = {
        orderStatus: this.orderStatus,
        priorityList: this.priorityList,
        sourceList: this.sourceList,
        businessTypeList: this.businessTypeList,
        orderTypeList:this.orderTypeList
      };
      let formInfo = this.form;
      if (this.advanceFilter.length <= 0) {
        this.advanceFilter = advanceFilterOption(valueArray, formInfo).column
      } else {
        this.advanceFilter = []
      }
    },
    filterChange (val) {
      this.advanceFilterData = val
      this.handleSearch()
    },
    getSelectFieldList (code) {
      let _this = this
      selectByCode(code).then(res => {
        if (res.data.retCode === 200) {
          if (code === 'priority') {
            _this.priorityList = res.data.data
          } else if (code === 'source') {
            _this.sourceList = res.data.data
          } else if (code === 'business_type') {
            _this.businessTypeList = res.data.data
          } else if (code ==='order_type') {
            _this.orderTypeList =  res.data.data
            this.institutionList =this.selectAlllInfoFun('dept')
          }
        }
      })
    },
    // 点击合并工单跳转页面
    mergeOrder () {
      if (this.exportWorkOrderIdList < 1) {
        this.$message({
          message: '请选择要合并的数据',
          type: "error"
        });
        return;
      }
      this.$store.commit('orderTitleFun', '合并')
      this.$router.push({
        name: "createForm",
        params: {
          list: this.exportWorkOrderIdList,
          typeData: 3
        }
      });
    },
    closeSelect () {
      if (this.selectAllIdLength === 0) {
        this.$message({
          message: "请选择操作项",
          type: "error"
        });
      } else {
        this.$confirm("工单关闭后，未流转的工单将停止流转", "确认关闭工单", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          center: true,
          customClass: "messageBox-prompt-delete"
        }).then(() => {
          let params = {
            idList: this.exportWorkOrderIdList,
            userId: this.$store.state.userId,
          };
          closeBatch(params)
            .then(res => {
              if (res.data.retCode === 200) {
                this.$message({
                  type: "success",
                  message: "关闭成功!"
                });
                this.handleSearch();
                this.advancedFilterData()
              }
            })
            .catch(error => {
              console.log(error)
            });
        });
      }
    },
    // 根据类型id查询用户列表
    getUserListByWorkOrderTypeNodeIdInfo (id) {
      getUserListByWorkOrderTypeNodeId(id).then(res => {
        if (res.data.retCode === 200) {
          this.forms.userOptions = res.data.data;
        }
      });
    },
    // 重置筛选信息
    resart () {
      for (let i in this.form) {
        this.form[i] = ''
      }
      for (let j in this.current_handler_name) {
        this.current_handler_name[j] = ''
      }
    },
    // 导出
    exportOrder () {
      let params = {
        workOrderIdList: this.exportWorkOrderIdList,
        workOrderSelectInputDto: {
          currentPage: this.orderPage.page, // 当前页
          field: this.field, // 排序
          sortTag: this.sortTag, // 排序 0 1 切换
          pageSize: this.orderPage.pageSize, // 每页数量
          workOrderFilterId: Number(this.$store.state.orderTypeId), // 点击的工单流程id
          userId: this.$store.state.userId, // 当前用户
          createTime: this.form.createTime || [], // 创建时间
          workOrderStatusId: this.form.workOrderStatusId, // 工单状态
          // searchContent: this.form.searchContent || "",
          // priority: this.form.priority, // 工单优先级
          // source: this.form.source, // 工单来源
          // clientName: this.form.clientName, // 客户姓名
          // createUserName: this.form.createUserName, // 坐席姓名/工号
          // phone: this.form.phone, // 来电号码
          // problemDesc: this.form.problemDesc, // 工单内容
          customField: this.customField
        }
      }
      writeWithHead(params).then(res => {
        if (res.status === 200) {
          this.$message({
            type: "success",
            message: '导出成功'
          })
          const blob = new Blob([res.data]);
          const fileName = '导出文件.xlsx';//下载文件名称
          const elink = document.createElement('a');
          elink.download = fileName;
          elink.style.display = 'none';
          elink.href = URL.createObjectURL(blob);
          document.body.appendChild(elink);
          elink.click();
          URL.revokeObjectURL(elink.href); // 释放URL 对象
          document.body.removeChild(elink);
        } else {
          this.$message({
            type: "error",
            message: '导出失败'
          });
        }
      });
    },
    //* ***开始**** 下载base64文件流代码
    // dataURLtoBlob (dataurl, filename) {
    //   let arr = dataurl.split(",");
    //   let mime = arr[0].match(/:(.*?);/)[1];
    //   let bstr = atob(arr[1]);
    //   let n = bstr.length;
    //   let u8arr = new Uint8Array(n);
    //   while (n--) {
    //     u8arr[n] = bstr.charCodeAt(n);
    //   }
    //   return new Blob([u8arr], { type: mime });
    // },
    // downloadFile (url, name = "导出列表") {
    //   var a = document.createElement("a");
    //   a.setAttribute("href", url);
    //   a.setAttribute("download", name);
    //   a.setAttribute("target", "_blank");
    //   let clickEvent = document.createEvent("MouseEvents");
    //   clickEvent.initEvent("click", true, true);
    //   a.dispatchEvent(clickEvent);
    // },
    // downloadFileByBase64 (base64, name) {
    //   let myBlob = this.dataURLtoBlob(base64);
    //   let myUrl = URL.createObjectURL(myBlob);
    //   this.downloadFile(myUrl, name);
    // },
    //* ***结束**** 下载base64文件流代码
    // 获取工单状态列表
    getSelectAllWorkOrderStatusName () {
      selectAllWorkOrderStatusName().then(res => {
        if (res.data.retCode === 200) {
          this.orderStatus = res.data.data
        }
      });
      selectAllWorkOrderTypeName().then(res => {
        if (res.data.retCode === 200) {
          this.orderTypes = res.data.data;
        }
      });
    },
    orderDetails (val) {
      this.$store.commit("orderDetailsIdFun", val.id); // 工单编号的id
      this.$router.push('/formDetails/' + this.$store.state.orderDetailsId)
    },
    handleSearch () {
      this.orderPage.page = 1;
      this.handleSearchData();
    },
    // 根据条件查询table表格数据
    handleSearchData () {
      let hignParamsArr = []
      let highParams = {
        create_time: this.form.createTime || [], // 创建时间
        status_id: this.form.workOrderStatusId, // 工单状态
        id: this.form.workOrderId, // 工单编号
      }
      // 锦程定制
      if (window.CONFIG.itemType == '2') {
        let jinchendingzhi = {
          customer_name: this.form.customer_name || '', // 客户姓名
          phone_number: this.form.phone_number || '', // 来电号码
          id_number: this.form.id_number || '', // 身份证号
          application_number: this.form.application_number || '', // 申请号
          priority: this.form.priority || '', // 工单优先级
          source: this.form.source || '', // 工单来源
          business_type: this.form.business_type || '', // 业务类型
          create_user_name: this.form.createUser, // 锦程创建人
        }
        Object.assign(highParams, jinchendingzhi)
      }
      // 苏农定制
      if (window.CONFIG.itemType == '3') {
        let sunongdingzhi = {
          customer_name: this.form.customer_name || '', // 客户姓名
          priority: this.form.priority || '', // 工单优先级
          source: this.form.source || '', // 工单来源
          phone_number: this.form.phone_number || '', // 来电号码
          business_type: this.form.business_type || '', // 业务类型
          order_type:this.form.order_type || '', // 工单流程
          handle_institution:this.form.handle_institution || [] // 处理人涉及机构
        }
        Object.assign(highParams, sunongdingzhi)
      }
      for (var i in highParams) {
        let itemArr = []
        if (highParams[i]) {
          if (i === 'create_time' || i==='handle_institution') {
            itemArr[0] = i
            itemArr[1] = '='
            itemArr[2] =  highParams[i]
          } else{
            itemArr[0] = i
            itemArr[1] = 'like'
            itemArr[2] = typeof (highParams[i]) == 'string' ? highParams[i].trim() : highParams[i]
          }
          hignParamsArr.push(itemArr)
        }
      }
      let params = {
        // 基础参数
        currentPage: this.orderPage.page, // 当前页
        pageSize: this.orderPage.pageSize, // 每页数量
        userId: this.$store.state.userId, // 当前用户
        workOrderFilterId: Number(this.$store.state.orderTypeId), // 点击的工单流程id
        // 特殊定制
        current_handler_name: {
          type: this.current_handler_name.type,
          value: this.current_handler_name.type == 'dept' ? (this.current_handler_name.value.length > 0 ? [common.deepClone(this.current_handler_name.value)] : []) : (this.current_handler_name.value.length > 0 ? [this.current_handler_name.value] : [])
        },
        // 高频+高级筛选
        advancedSelect: this.advanceFilterData.concat(hignParamsArr)
      };

      let _this = this
      getSelect(params).then(res => {
        let data = res.data;
        // this.advanceFilterData = []
        if (data.retCode === 200) {
          _this.tableData = data.data;
          // _this.tableData = [{ "tel1": "18165367612", "tel2": "18165367612", "contactPerson1Job": null, "companyName": null, "customerSex": null, "remark": null, "idNumber": null, "content": "", "customerType": null, "industryType": null, "customerId": "506188683724980224", "tel": "15002079436", "contactPerson1": "123", "contactPerson1Tel": null, "id": 2131, "contactPerson2": null, "email": null, "qq": null, "idType": "身份证", "unionId": "xiaoqiao", "contactPerson2Job": null, "clientLevel": "2", "customerName": "何淑荞", "tenantId": "default", "contactPerson2Tel": null, "wechatId": null, "wechatNickname": null, "$index": 0, "$idType": "身份证", "$clientLevel": "VIP", "$customerSex": "" }]
          // 将自定义字段中的字段合并到第一层
          for (var i = 0; i < _this.tableData.length; i++) {
            _this.tableData[i].workOrderType = _this.tableData[i].workOrderTypeName
            _this.customField = _this.tableData[i].customField
            _this.tableData[i].customField_label = {
              file_label: 'name.txt'
            }
            Object.assign(_this.tableData[i], _this.tableData[i].customField, _this.tableData[i].customField_label)
          }
          _this.tableData.forEach(item => {
            for (var x in item) {
              switch (x) {
                case 'workOrderTypeName':
                  item['work_order_type_id'] = item.workOrderTypeName
                  break;
                case 'createTime':
                  item['create_time'] = item.createTime
                  break;
                case 'createUserName':
                  item['create_user_name'] = item.createUserName
                  break;
                case 'statusName':
                  item['status_id'] = item.statusName
                  break;
                case 'currentHandlerName':
                  item['current_handler_name'] = item.currentHandlerName
                  break;
                case 'isTimeOut':
                  item['is_time_out'] = item.isTimeOut
                  break;
                case 'closeTime':
                  item['close_time'] = item.closeTime
                  break;
                case 'urgeCount':
                  item['urge_count'] = item.urgeCount
                  break;
                default: x = item.x
              }
            }
          })
          _this.currentWorkOrderNodeId = "";
          // 当前过滤器下的工单流程id标识 用来调取流程模板
          for (var x = 0; x < data.data.length; x++) {
            if (data.data[x].currentWorkOrderNodeId) {
              _this.currentWorkOrderNodeId = data.data[0].currentWorkOrderNodeId;
            }
          }
          _this.orderPage.total = data.count
          _this.allWorkOrderIdList = [];
          for (var y = 0; y < data.data.length; y++) {
            _this.allWorkOrderIdList.push(data.data[y].id);
          }
          setTimeout(() => {
            _this.loading = false;
          }, 1000);
        } else {
          _this.$message({
            type: 'error',
            message: res.data.msg
          })
        }
      });
    },
    cancelTransfer () {
      this.transferShow = false;
    },
    changeDate () { },
    createForm (val) {
      this.$store.commit("orderTypeIdFun", this.$store.state.orderTypeId);
      this.$store.commit("orderTitleFun", val); // 主标题
      sessionStorage.setItem("workOrderIdList", JSON.stringify("")); // 新建工单的时候清空id
      this.$store.commit("orderDetailsIdFun", ""); // 新建工单的时候清空id
      this.$router.push({
        name: "createForm",
        params: {
          typeData: 3
        }
      });
    },
    handleSizeChange (pageSize) {
      this.orderPage.pageSize = pageSize;
      this.orderPage.page = 1;
      this.handleSearchData();
    },
    handleCurrentChange (page) {
      this.orderPage.page = page;
      this.handleSearchData();
    },
    // 删除
    deleteSelect () {
      if (!this.selectAllIdLength > 0) {
        this.$message({
          message: "请选择删除项",
          type: "error"
        });
      } else {
        this.$confirm("确认要删除吗？", "确认删除", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          center: true,
          customClass: "messageBox-prompt-delete"
        }).then(() => {
          let params = {
            idList: this.exportWorkOrderIdList,
            userId: this.$store.state.userId
          };
          deleteBatch(params).then(res => {
            if (res.data.retCode === 200) {
              this.$message({
                type: "success",
                message: "删除成功!"
              });
              this.handleSearch();
              this.advancedFilterData()
              this.selectAllIdLength = 0
            }
          });
        });
      }
    },
    // 选择相对应编号的数据
    handleSelectionChange (val) {
      this.multipleSelection = val;
      this.selectAllIdLength = val.length;
      this.workOrderIdList = [];
      this.exportWorkOrderIdList = [];
      for (var i = 0; i < this.multipleSelection.length; i++) {
        // 所有状态的工单列表
        this.exportWorkOrderIdList.push(this.multipleSelection[i].id);
      }
    },
    change () { }
  }
};
</script>
<style scoped>
.paging-foot {
  padding: 20px 0;
}

>>> .el-range-separator {
  width: 6%;
}

>>> .default {
  background: transparent;
  border: none;
}

.btn30-default,
.export {
  color: black;
  background: #f5f6fa;
  margin-left: 20px;
}

>>> .el-icon--right {
  color: #2393f1;
}

.el-row {
  line-height: 30px;
}

.el-divider--horizontal {
  margin: 20px 0;
}

.el-row > .font-weight {
  font-weight: bold;
  color: #231815;
  font-size: 13px;
}

.select-number {
  color: #b50029;
}

/* .el-button {
  padding: 0;
} */

>>> .el-date-editor .el-range-separator {
  padding: 0;
  margin: 0 5px;
}

.el-header-content {
  margin-bottom: 20px;
  line-height: 40px;
}
>>> .el-input__inner {
  min-width: 100%;
}

.item {
  margin-top: 10px;
  /* margin-right: 40px; */
}

>>> .el-badge__content.is-fixed {
  background-color: #f78c35;
  line-height: 15px;
}

/* 排序按钮 */
/* .behavior-button {
  color: #2594f2;
  text-decoration: underline;
  float: left;
} */

>>> .el-input__icon {
  color: #2594f2;
  font-weight: bold;
}

/* .problemDesc {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
} */

.order_num {
  white-space: pre-wrap;
  text-decoration: underline;
  cursor: pointer;
  color: #4786c3;
}
>>> .el-badge__content.is-fixed {
  top: 3px;
  right: 36px;
}
/* avue */
>>> .el-form-item__label {
  white-space: nowrap;
  text-align: left;
}

>>> .avue-form__menu--center {
  display: none;
}
.searchBtn {
  margin-bottom: 20px;
  margin-left: 15px;
}
>>> .avue-group__item {
  padding: 0;
}
>>> .avue-crud__tip {
  display: none;
}
>>> .el-table__empty-block {
  width: 100%;
}
>>> .avue-crud__menu {
  display: none;
}
</style>
